/*
 * Copyright 2011 Raimon Rodriguez
 * 
 * This file is part of sgfx.
 * 
 * sgfx is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * sgfx is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with sgfx. If not, see <http://www.gnu.org/licenses/>.
 */

package com.googlecode.sgfx.base;

import javax.swing.KeyStroke;

/**
 * This class contains utility methods to help deal with {@code KeyStroke}.
 * 
 * @author raimon.rodriguez
 */
public final class Keys {
    private static final int NO_MODIFIERS = 0;

    private Keys() {}


    /**
     * Returns a shared instance of a {@code KeyStroke}, given a numeric key code, without modifiers.
     * The returned {@code KeyStroke} will correspond to a key press.
     *
     * <p>
     * This method call is effectively equivalent to the call:
     * </p>
     * <code>
     * KeyStroke.getKeyStroke(pKeyCode, 0);
     * </code>
     * 
     * @param pKeyCode the numeric code for a keyboard key.
     * @return the shared instance of {@code KeyStroke} for that particular key code.
     * @see java.awt.KeyEvent
     * @see KeyStroke#getKeyStroke(int, int)
     */
    public static KeyStroke stroke(int pKeyCode) {
        return KeyStroke.getKeyStroke(pKeyCode, NO_MODIFIERS);
    }
}
